<!DOCTYPE html>
<html lang="en-us">
	<head>
		<meta charset="utf-8">
		<!--<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">-->

		<title> 智能互联，成就卓越物流 </title>
		<meta name="description" content="">
		<meta name="author" content="">

		<!-- Use the correct meta names below for your web application
			 Ref: http://davidbcalhoun.com/2010/viewport-metatag 
			 
		<meta name="HandheldFriendly" content="True">
		<meta name="MobileOptimized" content="320">-->
		
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

		<!-- Basic Styles -->
		<link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" media="screen" href="css/font-awesome.min.css">

		<!-- SmartAdmin Styles : Please note (smartadmin-production.css) was created using LESS variables -->
		<link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-production.css">
		<link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-skins.css">
        
		<!-- G7 fix -->
		<link rel="stylesheet" type="text/css" media="screen" href="css/demo-increase.css">
        
		<!-- SmartAdmin RTL Support is under construction
		<link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-rtl.css"> -->
		<!-- daterangepicker Styles  -->
		<link rel="stylesheet" type="text/css" media="screen" href="css/daterangepicker-bs3.css">

		<!-- We recommend you use "your_style.css" to override SmartAdmin
		specific styles this will also ensure you retrain your customization
		with each SmartAdmin update.
		<link rel="stylesheet" type="text/css" media="screen" href="css/demo.css"> -->

		<!-- Demo purpose only: goes with demo.js, you can delete this css when designing your own WebApp -->
		<link rel="stylesheet" type="text/css" media="screen" href="css/demo.css">
		
		<!-- 设置表头左右选择插件样式 -->
		<link rel="stylesheet" type="text/css" media="screen" href="css/jquery.multiselect2side.css">

		<!-- FAVICONS -->
		<link rel="shortcut icon" href="img/favicon/favicon.ico" type="image/x-icon">
		<link rel="icon" href="img/favicon/favicon.ico" type="image/x-icon">

		<!-- GOOGLE FONT
		<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,300,400,700"> -->

	</head>
	<body class="" >
<div class="row"><br /></div>
<div class="well well-light no-padding">
	<form action="" class="smart-form" novalidate="novalidate" id="info-form">
		<header>录入IMEI</header>
		<fieldset>
			<section class="col-xs-12 col-sm-6">
				<div class="">
					<label class="label col col-4 text-align-right">IMEI</label>
					<label class="col col-6 no-padding">
						<label class="input">
							<input type="text" id="imei_id" placeholder="" >
							<b class="tooltip tooltip-top-right">IMEI</b>
						</label>
					</label>
				</div>
			</section>

			<section class="col-xs-12 col-sm-6">
				<div class="">
					<label class="label col col-4 text-align-right">所属机构</label>
					<label class="col col-6 no-padding">
					    <label class="input">
							<input type="text" id="org_id" list="list">
							<datalist id="list">
							</datalist>
							<i></i> 
						</label>
					</label>
				</div>
			</section>
		</fieldset>

		<footer>
			<div id="cancel" class="btn btn-default">取消</div>
			<!-- <button type="submit" id="confirm" class="btn btn-primary"> -->
			<div id="confirm" class="btn btn-primary">
				<i class="fa fa-save"></i>
				保存
			</div>
		</footer>
		
	</form>
	<form action="" class="smart-form" novalidate="novalidate" id="info-form">
		<header>录入客戶里程</header>
		<fieldset>
			<section class="col-xs-12 col-sm-6">
				<div class="">
					<label class="label col col-4 text-align-right">IMEI</label>
					<label class="col col-6 no-padding">
						<label class="input">
							<input type="text" id="imei_id2" placeholder="" >
							<b class="tooltip tooltip-top-right">IMEI</b>
						</label>
					</label>
				</div>
			</section>

			<section class="col-xs-12 col-sm-6">
				<div class="">
					<label class="label col col-4 text-align-right">所属机构</label>
					<label class="col col-6 no-padding">
					    <label class="input">
							<input type="text" id="org_id2" list="list2">
							<datalist id="list2">
							</datalist>
							<i></i> 
						</label>
					</label>
				</div>
			</section>
			<section class="col-xs-12 col-sm-6" >
				<label class="label col col-4 text-align-right">时间</label>
				<label class="col col-6 no-padding">
				<label class="input">
					<input type="text" value="" class="input-sm" id="reservation" maxlength="40" size=40>
				</label>
				</label>
			</section>
			<section class="col-xs-12 col-sm-6">
				<div class="">
					<label class="label col col-4 text-align-right">里程</label>
					<label class="col col-6 no-padding">
						<label class="input">
							<input type="text" id="mileage_id2" placeholder="" >
							<b class="tooltip tooltip-top-right">mileage</b>
						</label>
					</label>
				</div>
			</section>
		</fieldset>

		<footer>
			<div id="cancel2" class="btn btn-default">取消</div>
			<div id="confirm2" class="btn btn-primary">
				<i class="fa fa-save"></i>
				保存
			</div>
		</footer>
		
	</form>
</div>
<!--================================================== -->

		<!-- PACE LOADER - turn this on if you want ajax loading to show (caution: uses lots of memory on iDevices)
		<script data-pace-options='{ "restartOnRequestAfter": true }' src="js/plugin/pace/pace.min.js"></script>-->

		<!-- Link to Google CDN's jQuery + jQueryUI; fall back to local -->
		<script src="js/libs/jquery-2.0.2.min.js"></script>
		<script>
			if (!window.jQuery) {
				document.write('<script src="js/libs/jquery-2.0.2.min.js"><\/script>');
			}
		</script>

		<script src="js/libs/jquery-ui-1.10.3.min.js"></script>
		<script>
			if (!window.jQuery.ui) {
				document.write('<script src="js/libs/jquery-ui-1.10.3.min.js"><\/script>');
			}
		</script>

		<!-- JS TOUCH : include this plugin for mobile drag / drop touch events
		<script src="js/plugin/jquery-touch/jquery.ui.touch-punch.min.js"></script> -->

		<!-- BOOTSTRAP JS -->
		<script src="js/bootstrap/bootstrap.min.js"></script>

		<!-- CUSTOM NOTIFICATION -->
		<script src="js/notification/SmartNotification.min.js"></script>

		<!-- JARVIS WIDGETS -->
		<script src="js/smartwidgets/jarvis.widget.min.js"></script>

		<!-- EASY PIE CHARTS -->
		<script src="js/plugin/easy-pie-chart/jquery.easy-pie-chart.min.js"></script>

		<!-- SPARKLINES -->
		<script src="js/plugin/sparkline/jquery.sparkline.min.js"></script>

		<!-- JQUERY VALIDATE -->
		<script src="js/plugin/jquery-validate/jquery.validate.min.js"></script>
		<script src="js/plugin/jquery-validate/localization/messages_zh.js"></script>
		

		<!-- JQUERY MASKED INPUT -->
		<script src="js/plugin/masked-input/jquery.maskedinput.min.js"></script>

		<!-- JQUERY SELECT2 INPUT -->
		<script src="js/plugin/select2/select2.min.js"></script>

		<!-- JQUERY UI + Bootstrap Slider -->
		<script src="js/plugin/bootstrap-slider/bootstrap-slider.min.js"></script>

		<!-- browser msie issue fix -->
		<script src="js/plugin/msie-fix/jquery.mb.browser.min.js"></script>

		<!-- SmartClick: For mobile devices -->
		<script src="js/plugin/smartclick/smartclick.js"></script>

		<!--[if IE 7]>

		<h1>你的浏览器版本太低，为了您正常使用本系统，请到此处升级浏览器版本 www.microsoft.com/download</h1>

		<![endif]-->

		<!-- Demo purpose only -->
		<script src="js/demo.js"></script>

		<!-- MAIN APP JS FILE -->
		<script src="js/jquery.cookie.js"></script>
		<script src="js/app.js"></script>
		
		<!-- Your GOOGLE ANALYTICS CODE Below -->
		<script type="text/javascript">
		  var _gaq = _gaq || [];
		  _gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
		  _gaq.push(['_trackPageview']);
		
		  (function() {
		    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
		  });
		
		</script>
<!-- daterangepicker JS -->
<script src="js/plugin/date/moment.js"></script>
<script src="js/plugin/date/daterangepicker.js"></script>
<script type="text/javascript">

	// DO NOT REMOVE : GLOBAL FUNCTIONS!
	pageSetUp();
	
	initOrgCode();
	
	$("#confirm").click(function(event) {
		var imei_val = $.trim($('#imei_id').val());
		var org_val = $.trim($('#org_id').val());
		
		if(imei_val.length==0 || org_val.length==0){
			showTips('imei和组织机构不能为空',40,300,2);
			return;
		}
		$.ajax({
			url: '/smarttest-frontstage/adddevice.action',
		  	dataType : 'json',
		  	method:'GET',
		  	data: {imei:$('#imei_id').val(), 
		  		   orgcode:$('#org_id').val()},
		  	complete : function(data){
		  		if (data.responseJSON == 1)
		  			showTips('操作成功',40,100,2);
		  		else
		  			showTips('操作失败',40,100,2);
		  	}
		});
	});
	
	$("#cancel").click(function(event) {
		$('#imei_id').val()="";
		$('#org_id').val()="";
		
	});
	
	$("#confirm2").click(function(event) {
		var imei_val = $.trim($('#imei_id2').val());
		var org_val = $.trim($('#org_id2').val());
		var mileage_val = $.trim($('#mileage_id2').val());
		
		if(imei_val.length==0 || org_val.length==0 || mileage_val==0){
			showTips('imei,组织机构,里程不能为空',40,350,2);
			return;
		}
		$.ajax({
			url: '/smarttest-frontstage/addmileage.action',
		  	dataType : 'json',
		  	method:'GET',
		  	data: {gpsno:$('#imei_id2').val(), 
		  		   orgcode:$('#org_id2').val(),
		  		   starttime:starttime.format("YYYY-MM-DD"),
		  		   mileage:$('#mileage_id2').val()},
		  	complete : function(data){
		  		if (data.responseJSON == 1)
		  			showTips('操作成功',40,100,2);
		  		else
		  			showTips('操作失败',40,100,2);
		  	}
		});
	});
	
	$("#cancel2").click(function(event) {
		$('#imei_id2').val()="";
		$('#org_id2').val()="";
		$('#mileage_id2').val()="";
		
	});
	
	$('#reservation').daterangepicker({
		singleDatePicker: true, //必须要有默input 认value
		timePicker: false,		//是否启用时间选择
		//timePickerIncrement:5,	//分钟选择的间隔
		format: 'YYYY-MM-DD',	//返回值的格式
		//timePicker12Hour: false,	//采用24小时计时制
		showDropdowns: true,		//是否显示年、月下拉框
		startDate: moment().startOf('day'),
	    endDate: moment().startOf('day')
	},function(start,end,label){
		starttime = start;
		endtime = end;
	});
	
	var picker = $('#reservation').data('daterangepicker');
	var starttime = picker.startDate;
	var endtime = picker.endDate;

	document.getElementById("reservation").value=starttime.format("YYYY-MM-DD");
	
	function initOrgCode(){
		$.ajax({
			url : '/smarttest-frontstage/getorgcode.action',
			dataType : 'json',
			method : 'GET',
			success : function(data) {
				 var tobeadd = '';
				 $.each(data, function (key, value) {
					tobeadd+="<option value='"+value.orgcode+"'>"+value.orgcode+"</option>"; 
		         });
				 $("#list").html("");
				 $("#list").append(tobeadd);
				 $("#list2").html("");
				 $("#list2").append(tobeadd);
			}
		});
	}
	
	function showTips(tips, height, sizeWidth, time) {
		var windowWidth = document.documentElement.clientWidth;
		var tipsDiv = '<div class="tipsClass">' + tips + '</div>';

		$('body').append(tipsDiv);
		
		$('div.tipsClass').css({
			'top': '50%',
			'right': 0,
			'left': 0,
			'bottom': 0,
			'position': 'absolute',
			'padding': '3px 5px',
			'background': '#8FBC8F',
			'font-size': 20 + 'px',
			'margin': '0 auto',
			'text-align': 'center',
			'height':height + 'px',
			'width': sizeWidth +'px',
			'color': '#fff',
			'opacity': '0.8'
			}).show();

		setTimeout(function () { $('div.tipsClass').fadeOut(); }, (time * 1000));
	}

</script>

	</body>

</html>
